package com.yape.controller;

import com.yape.response.Response;
import com.yape.stockService.impl.SectorFundFlowService;
import com.yape.vo.SectorFundFlowVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zmele
 * @description
 * @date 2025/5/25 15:29
 */
@RestController
@RequestMapping("/api/sectors/")
@CrossOrigin("*")
@Slf4j
public class SectorFundFlowController {

    @Resource
    private SectorFundFlowService sectorFundFlowService;

    @GetMapping("daily-performance")
    public Response<List<SectorFundFlowVO>> getDailyPerformance() {
        log.info("获取板块当日涨跌幅");
        List<SectorFundFlowVO> sectorFundFlowVOS = sectorFundFlowService.querySectorFoundFlow();

        return Response.<List<SectorFundFlowVO>>builder()
                .code("200")
                .message("success")
                .data(sectorFundFlowVOS)
                .build();
    }
}